package com.ask.model;

import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import lombok.*;
import org.springframework.data.annotation.Id;

@Getter //(所有字段)
@Setter //(所有非final字段)
@Document(collection = "User")
public class User implements Serializable {

    @Id
    @Field("_id")
    //@JsonIgnore
    private String id;//By default the id in mongo collection is string.

    @ApiModelProperty(value = "注册时间")
    private Date registerTime;

    @ApiModelProperty(value = "昵称")
    private String nickname;

    @ApiModelProperty(value = "头像链接")
    private String headUrl;//可以为空

    @ApiModelProperty(value = "email")//也是唯一标识
    private String email;

    @ApiModelProperty(value = "password")
    private String password;

    private static final long serialVersionUID = 1L;

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", registerTime=").append(registerTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
